home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / debug / memmon.dir / 00022_Main.ls < prev    next >
Encoding:
Text File  |  1995-02-15  |  5.7 KB  |  212 lines

  1. on startMovie
  2.   CheckForValidName()
  3.   initGlobals()
  4.   InitConditions()
  5.   initpuppets()
  6. end
  7.  
  8. on CheckForValidName
  9.   set flag to 0
  10.   repeat with temp = 1 to count(the windowList)
  11.     if the title of window temp = "memmon" then
  12.       set flag to 1
  13.     end if
  14.   end repeat
  15.   if (the windowList = []) or not flag then
  16.     alert("Please open the memmon with the title Memmon.  Like this: From the message window, type - Open window " & QUOTE & "memmon" & QUOTE & ".   Open the main movie script for help.           Thank you, the management.")
  17.   end if
  18. end
  19.  
  20. on initGlobals
  21.   global gBar, gOtherBar, gStartCast, gEndCast, gStartFrame, gEndFrame, gLevel, gTemp, gTempo
  22.   set gBar to 10
  23.   set gOtherBar to 26
  24.   set gStartCast to the value of field "CastStart"
  25.   set gEndCast to the value of field "CastEnd"
  26.   set gStartFrame to the value of field "FrameStart"
  27.   set gEndFrame to the value of field "FrameEnd"
  28.   set gTemp to 0
  29.   set gTempo to 5
  30.   set gLevel to 2
  31. end
  32.  
  33. on InitConditions
  34.   set the floatPrecision to 3
  35. end
  36.  
  37. on initpuppets
  38.   global gBar
  39.   puppetSprite(gBar, 1)
  40.   puppetSprite(gOtherBar, 1)
  41.   puppetSprite(29, 1)
  42.   puppetSprite(30, 1)
  43.   puppetSprite(31, 1)
  44.   puppetSprite(32, 1)
  45.   puppetSprite(33, 1)
  46.   puppetSprite(34, 1)
  47. end
  48.  
  49. on DoMe
  50.   global gLevel
  51.   UpdateGraph()
  52.   if gLevel > 1 then
  53.     UpdateFields()
  54.   end if
  55. end
  56.  
  57. on UpdateGraph
  58.   global gBar, gOtherBar
  59.   if voidp(gBar) then
  60.     startMovie()
  61.   end if
  62.   set the height of sprite gBar to (the height of cast "border" * (the freeBytes * 1.0) / the memorysize) + 1.0
  63.   set the height of sprite gOtherBar to (the height of cast "border" * (the freeBlock * 1.0) / the memorysize) + 1.0
  64. end
  65.  
  66. on UpdateFields
  67.   put the memorysize & " = " & the memorysize / 1024 & "k" into field "memsize"
  68.   put the freeBytes & " = " & the freeBytes / 1024 & "k" into field "freebytes"
  69.   put the freeBlock & " = " & the freeBlock / 1024 & "k" into field "freeblock"
  70.   put the memorysize - the freeBytes & " = " & (the memorysize - the freeBytes) / 1024 & "k" into field "MemUsed"
  71. end
  72.  
  73. on GetValues
  74.   global gStartCast, gEndCast, gStartFrame, gEndFrame, gTemp
  75.   set gStartCast to the value of field "CastStart"
  76.   set gEndCast to the value of field "CastEnd"
  77.   set gStartFrame to the value of field "FrameStart"
  78.   set gEndFrame to the value of field "FrameEnd"
  79.   tell the stage
  80.     set gTemp to the number of castMembers
  81.   end tell
  82.   if gEndCast > gTemp then
  83.     set gEndCast to gTemp
  84.   end if
  85. end
  86.  
  87. on startTimer
  88.   return the ticks
  89. end
  90.  
  91. on PutTime now
  92.   set delta to the ticks - now
  93.   put "ticks = " & delta into field "delta t"
  94.   put RETURN & "secs = " & delta / 60.0 after field "delta t"
  95. end
  96.  
  97. on InitTime
  98.   global gNow
  99.   set gNow to the ticks
  100. end
  101.  
  102. on CheckTime
  103.   global gNow
  104.   put the ticks - gNow
  105. end
  106.  
  107. on DoRight
  108.   set the castNum of sprite the clickOn to the number of cast "Left"
  109.   set wind to window "memmon"
  110.   set leftSide to getAt(the rect of wind, 1)
  111.   set topSide to getAt(the rect of wind, 2)
  112.   set rightSide to getAt(the rect of wind, 3)
  113.   set bottomSide to getAt(the rect of wind, 4)
  114.   set the rect of wind to rect(leftSide, topSide, rightSide + 128, bottomSide)
  115. end
  116.  
  117. on DoLeft
  118.   set the castNum of sprite the clickOn to the number of cast "Right"
  119.   set wind to window "memmon"
  120.   set leftSide to getAt(the rect of wind, 1)
  121.   set topSide to getAt(the rect of wind, 2)
  122.   set rightSide to getAt(the rect of wind, 3)
  123.   set bottomSide to getAt(the rect of wind, 4)
  124.   set the rect of wind to rect(leftSide, topSide, rightSide - 128, bottomSide)
  125. end
  126.  
  127. on DoUp arrow
  128.   if voidp(arrow) then
  129.     set the castNum of sprite the clickOn to the number of cast "down"
  130.   else
  131.     set the castNum of sprite 29 to 0
  132.     updateStage()
  133.   end if
  134.   set wind to window "memmon"
  135.   set leftSide to getAt(the rect of wind, 1)
  136.   set topSide to getAt(the rect of wind, 2)
  137.   set rightSide to getAt(the rect of wind, 3)
  138.   set bottomSide to getAt(the rect of wind, 4)
  139.   set the rect of wind to rect(leftSide, topSide, rightSide, bottomSide - 86)
  140. end
  141.  
  142. on DoDown arrow
  143.   if voidp(arrow) then
  144.     set the castNum of sprite the clickOn to the number of cast "up"
  145.   else
  146.     set the castNum of sprite 29 to the number of cast "up"
  147.   end if
  148.   set wind to window "memmon"
  149.   set leftSide to getAt(the rect of wind, 1)
  150.   set topSide to getAt(the rect of wind, 2)
  151.   set rightSide to getAt(the rect of wind, 3)
  152.   set bottomSide to getAt(the rect of wind, 4)
  153.   set the rect of wind to rect(leftSide, topSide, rightSide, bottomSide + 86)
  154. end
  155.  
  156. on GetMainMovieName
  157.   global gMovie
  158.   tell the stage
  159.     set gMovie to the movieName
  160.   end tell
  161.   put gMovie into field "Moviename"
  162. end
  163.  
  164. on ResetTabButtons
  165.   set the backColor of sprite 31 to 250
  166.   set the backColor of sprite 32 to 245
  167.   set the backColor of sprite 33 to 245
  168.   set the backColor of sprite 34 to 245
  169. end
  170.  
  171. on TurnOffDepthPuppets
  172.   repeat with temp = 13 to 17
  173.     puppetSprite(temp, 0)
  174.   end repeat
  175. end
  176.  
  177. on TurnOffVolumePuppets
  178.   repeat with temp = 35 to 40
  179.     puppetSprite(temp, 0)
  180.     puppetSprite(temp, 0)
  181.   end repeat
  182. end
  183.  
  184. on UpdateMeters
  185.   set mainVolHeight to 64 - (9 * the soundLevel)
  186.   set the height of sprite 35 to mainVolHeight
  187.   set the locV of sprite 38 to 69 + mainVolHeight - 3
  188.   set mainVolHeight to 64 - (0.25099999999999995 * the volume of sound 1)
  189.   set the height of sprite 36 to mainVolHeight
  190.   set the locV of sprite 39 to 69 + mainVolHeight - 3
  191.   set mainVolHeight to 64 - (0.25099999999999995 * the volume of sound 2)
  192.   set the height of sprite 37 to mainVolHeight
  193.   set the locV of sprite 40 to 69 + mainVolHeight - 3
  194. end
  195.  
  196. on Memmon
  197.   go(1)
  198.   set the rect of window "memmon" to the sourceRect of window "memmon"
  199.   open(window "memmon")
  200. end
  201.  
  202. on InitTempoIndicator
  203.   global gTempo
  204.   puppetSprite(22, 0)
  205.   puppetSprite(22, 1)
  206.   set the locV of sprite 22 to the bottom of sprite 21 - (gTempo * 3) - 1
  207. end
  208.  
  209. on TurnOffTempoPuppets
  210.   puppetSprite(22, 0)
  211. end
  212.